package com.chenyun.infra.xxljob.admin.core.util;

import com.chenyun.common.vo.AjaxResult;
import com.xxl.job.core.biz.model.ReturnT;

import java.io.Serializable;

/**
 * AjaxRetunT：
 * Description:
 *
 * @author: Lonni
 * @date: 2024/1/4 0004 11:02
 */
public class AjaxReturnT implements Serializable {

    public static AjaxResult result(ReturnT returnT) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(returnT.getCode() == 200 ? 200 : 10001);
        ajaxResult.setMessage(returnT.getMsg());
        ajaxResult.setSuccess(returnT.getCode() == 200);
        ajaxResult.setData(returnT.getContent());
        return ajaxResult;
    }

    public static AjaxResult result(int code,String msg) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(code == 200 ? 200 : 10001);
        ajaxResult.setMessage(msg);
        ajaxResult.setSuccess(code == 200);
        return ajaxResult;
    }
}



